package com.project.handle.takewayRiderHandle;

import com.project.handle.TakewayRiderHandle;
import com.project.pojo.RiskController;
import com.project.utils.ErrorMessage;
import com.project.utils.GetRiskCode;
import com.project.vo.TakewayRiderMessage;
import org.apache.commons.lang.StringUtils;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import java.util.List;
@Component
@Order(4)
public class TakewayRiderCarTypeHandleImpl extends TakewayRiderHandle {
    @Override
    public void takewayRiderRiskAssess(TakewayRiderMessage takewayRiderMessage, List<RiskController> list, List<ErrorMessage> errorMessageList) {
        if(StringUtils.isEmpty(takewayRiderMessage.getCarType())){
            ErrorMessage errorMessage = new ErrorMessage();
            errorMessage.setError("非机动车辆信息为错误!");
            errorMessageList.add(errorMessage);
            return;
        }

        int code = GetRiskCode.getCode(takewayRiderMessage.getCarType(),list);
        int preCode = takewayRiderMessage.getRiskCode();
        takewayRiderMessage.setRiskCode(preCode+code);
    }
}
